home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
ooptut34.zip
/
TP
/
OOPTUTOR
/
OBJINIT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-11-09
|
1KB
|
44 lines
program object_initialization;
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
{ Program to illustrate the initialization of a record by the use of an }
{ object as opposed to conventional methods. R. Shaw 17.2.91 }
{ OBJINIT.PAS -> OBJINIT.EXE }
{________________________________________________________________________}
uses Crt;
type
obj = object
i : integer;
r : real;
s : string[50];
procedure Init( int : integer; re : real; st : string);
end;
procedure Obj.Init( int : integer; re : real; st : string);
begin
begin
i := int;
r := re;
s := st;
end;
end; { of method Obj.Init }
var
ThisObj : obj;
begin
ClrScr;
ThisObj.Init(1234, 9.876, 'This is the string entry for this object');
writeln( 'The integer value is ', ThisObj.i);
writeln( 'The real value is ', ThisObj.r);
writeln( 'The string is " ', ThisObj.s, '"');
writeln;
writeln;
write('Press any key to continue: ');
repeat until keypressed;
end.